<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix="display"%>

<link href="<%= request.getContextPath() + "/css/bloques.css" %>" rel="stylesheet" type="text/css">
<link href="<%= request.getContextPath() + "/css/table.css" %>" rel="stylesheet" type="text/css">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Consultar</title>
<script language="JavaScript" type="text/javascript">    

    var a, mes, dia, anyo, febrero;
  
    function anyoBisiesto(anyo)
    {
        
        if (anyo < 100)
            var fin = anyo + 1900;
        else
            var fin = anyo ;

        if (fin % 4 != 0)
            return false;
        else
        {
            if (fin % 100 == 0)
            {
                if (fin % 400 == 0)
                {
                    return true;
                } else
                {
                    return false;
                }
            }
            else
            {
                return true;
            }
        }
    }
    
   
    function validar( )
    {
       a=document.actualizarBeneficiario.dia.value+"/"+document.actualizarBeneficiario.mes.value+"/"+document.actualizarBeneficiario.ano.value;
       dia=a.split("/")[0];
       mes=a.split("/")[1];
       anyo=a.split("/")[2];
       if(document.actualizarBeneficiario.numeroDocumento.value==""){
          alert("Debe introducir el numero de documento");
          document.actualizarBeneficiario.numeroDocumento.focus();
          return;
       }
       
       if(document.actualizarBeneficiario.primer_nombre.value==""){
          alert("Debe introducir el primer nombre");
          document.actualizarBeneficiario.primer_nombre.focus();
          return;
       }
       
       if(document.actualizarBeneficiario.primerApellido.value==""){
          alert("Debe introducir el primer apellido");
          document.actualizarBeneficiario.primerApellido.focus();
          return;
       }
       if(dia == 'dia' && mes == 'mes' && anyo == 'ano')
       {
          document.actualizarBeneficiario.submit(); 
       }else{
        if( (isNaN(dia)==true) || (isNaN(mes)==true) || (isNaN(anyo)==true) )
        {
            alert("La fecha introducida debe estar formada solo por numeros");
         return;
        }
       if(anyoBisiesto(anyo))
           febrero=29;
       else
           febrero=28;
      
       if ((mes<1) || (mes>12))
       {
           alert("El mes introducido no es valido. Por favor, introduzca un mes correcto");
           document.actualizarBeneficiario.mes.focus();
           //document.actualizarBeneficiario.fecha.select();
           return;
       }
       
       if ((mes==2) && ((dia<1) || (dia>febrero)))
       {
           alert("El dia introducido no es valido. Por favor, introduzca un dia correcto");
           document.actualizarBeneficiario.dia.focus();
           //document.actualizarBeneficiario.fecha.select();
           return;
       }
      
       if (((mes==1) || (mes==3) || (mes==5) || (mes==7) || (mes==8) || (mes==10) || (mes==12)) && ((dia<1) || (dia>31)))
       {
           alert("El dia introducido no es valido. Por favor, introduzca un dia correcto");
           document.actualizarBeneficiario.dia.focus();
           //document.actualizarBeneficiario.fecha.select();
           return;
       }
       
       if (((mes==4) || (mes==6) || (mes==9) || (mes==11)) && ((dia<1) || (dia>30)))
       {
           alert("El dia introducido no es valido. Por favor, introduzca un dia correcto");
           document.actualizarBeneficiario.mes.focus();
           //document.actualizarBeneficiario.fecha.select();
           return;
       }
       
       if ((anyo<1900) || (anyo>2020))
       {
           alert("El año introducido no es valido. Por favor, introduzca un año entre 1900 y 2010");
           document.actualizarBeneficiario.ano.focus();
           //document.actualizarBeneficiario.fecha.select();
           return;
       } 
      field = document.actualizarBeneficiario.dirDescriptiva; 
      if(document.actualizarBeneficiario.dirDescriptiva.value != ""){
        var valid = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopqrstuvwxyz 1234567890"
        var ok = "yes";
        var temp;
        for (var i=0; i<field.value.length; i++) {
        temp = "" + field.value.substring(i, i+1);
        if (valid.indexOf(temp) == "-1") ok = "no";
        }
      }
      if (ok == "no") {
        alert("La direccion descriptiva solo permite letras (A - Z | a - z)");
        field.focus();
        field.select();
        return;
      }
      
        
       else
          document.actualizarBeneficiario.submit();
      }
    }  

  function buscarBarrios(origen)
  {
    document.actualizarBeneficiario.action = 'ConsultarBeneficiario.do'; 
    document.actualizarBeneficiario.opcion.value = origen; 
    document.actualizarBeneficiario.submit(); 
  }
  
 
  function LimpiarEnc()
  {
    document.actualizarBeneficiario.dirDescriptiva.disabled = false;
    document.actualizarBeneficiario.dirEncasillada.value = '';
    document.actualizarBeneficiario.viaTipo.value = '';
    document.actualizarBeneficiario.vNro.value = '';
    document.actualizarBeneficiario.viaOrientacion.value = '';
    document.actualizarBeneficiario.viaApendice.value = '';
    document.actualizarBeneficiario.cruceOrientacion.value = '';
    document.actualizarBeneficiario.cruceNumero.value = '';
    document.actualizarBeneficiario.cruceApendice.value = '';
    document.actualizarBeneficiario.placa.value = '';
    document.actualizarBeneficiario.interior.value = '';
    document.actualizarBeneficiario.bloque.value = '';
  }

  function agregar(object,origen)
  {
    document.actualizarBeneficiario.dirDescriptiva.value="";
    document.actualizarBeneficiario.dirDescriptiva.disabled = true;
    if(document.actualizarBeneficiario.viaTipo.value==0){
      alert('El tipo no es valido.')
      return;
    }
    if(origen == 'tipo')
    {
      tipo = object.value.toUpperCase();
    }
    if(origen == 'vNro'){
      vNro = object.value.toUpperCase();
    }
    if(origen == 'vOr'){
      vOr = object.value.toUpperCase();
    }
    if(origen == 'vApn'){
      vApn = object.value.toUpperCase();
    }
    if(origen == 'cOr'){
      cOr = object.value.toUpperCase();
    }
    if(origen == 'cNro'){
      cNro = object.value.toUpperCase();
    }
    if(origen == 'cApn') {
      cApn = object.value.toUpperCase();
    }
    if(origen == 'placa'){
      placa = object.value.toUpperCase();
    }
    if(origen == 'interior'){
      interior = object.value.toUpperCase();
    }
    if(origen == 'bloque'){
      bloque = object.value;
    }
    
    direccion = "";
    if(tipo != null && tipo != '0')
      direccion += tipo+" ";
    if(vOr != null && vOr != "" && vOr != '0')
      direccion += vOr;
    if(vNro != null && vNro != "" && vNro != '0')
      direccion += vNro+" ";
    if(vApn != null && vApn != "" && vApn != '0')
      direccion += vApn+"   ";
    if(cOr != null && cOr != "" && cOr != '0')
      direccion += cOr+" ";
    if(cNro != null && cNro != "" && cNro != '0')
      direccion += cNro;
    if(cApn != null && cApn != "" && cApn != '0')
      direccion += cApn;
    if(placa != null && placa != "" && placa != '0')
      direccion += "-"+placa+" ";
    if(bloque != null && bloque != "" && bloque != '0')
      direccion += bloque;
    if(interior != null && interior != "" && interior != '0')
      direccion += "("+interior+")";
    
    //document.actualizarBeneficiario.dirEncasillada.value =  tipo+" "+vOr+vNro+" "+vApn+"   "+cOr+cNro+" "+cApn+" "+placa+" "+bloque+interior;
    document.actualizarBeneficiario.dirEncasillada.value =  direccion;
  }

</script>
</head>
<body>   
    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr align="left">
        <td height="25" colspan="12" align="center" class="titulosenblanco"> 
        <p>
         <STRONG>Actualizaci&oacute;n de la Informaci&oacute;n del Beneficiario</STRONG>
        </p>
        <p>&nbsp; </p>
       </td>
       </tr>
  
       <logic:present name="msg" scope="request">
          <%=request.getAttribute("msg")%>
       </logic:present>
       <html:form  action="/beneficiarios/ActualizarBeneficiario.do"  method="post"  type="com.cs.beneficios.web.form.BuscarBeneficiarioForm">
        <% String code = (String)request.getAttribute("code"); %>
        <input type="hidden" name="code" value="<%=code%>" />
        <tr align="left">
         <td height="25" colspan="12" class="titulosenblanco">   
          <table width="100%" border="0" cellspacing="3" cellpadding="3" class="titulosenrojo">
            <tr>
            <td width="28%">&nbsp;</td>
            <td colspan="3">       
                <DIV align="left">
                  <html:errors/>
                </DIV>
            </td></tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Tipo Documento</strong>
(*)            </td>
            <% String tipoDocumento = (String)request.getAttribute("tipoDocumento"); %>
            <td width="46%"> 
                  <html:select property="tipoDocumento" styleClass="form"  value="<%=tipoDocumento%>">
                    <html:option value="C">C&eacute;dula de ciudadania</html:option>
                    <html:option value="E">C&eacute;dula de extranjeria</html:option>
                    <html:option value="N">Nit</html:option>
                    <html:option value="P">Pasaporte</html:option>
                    <html:option value="R">Registro civil</html:option>
                    <html:option value="T">Tarjeta de identidad</html:option>
                    <html:option value="I">NIP</html:option>
                    <html:option value="U">NUIP</html:option>
                    <html:option value="S">NISE</html:option>
                    <html:option value="A">Cabildo</html:option>
                    <html:option value="O">Otro</html:option>
                  </html:select></td>
            <td width="3%">&nbsp;</td>
           </tr>
            <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla">
              <strong>Numero Documento </strong>(*) 
            </td>
            <td width="46%"> 
            <% String numeroDocumento = (String)request.getAttribute("numeroDocumento"); %>  
                    <html:text property="numeroDocumento" size="15" styleClass="form" value="<%=numeroDocumento%>"/></td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Primer Nombre</strong> (*)&nbsp;&nbsp; 
            </td>
            <td width="46%"> 
            <% String primer_nombre = (String)request.getAttribute("primer_nombre"); %>  
                    <html:text property="primer_nombre" size="30" styleClass="form" value="<%=primer_nombre%>"/></td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Segundo Nombre</strong> 
            </td>
            <td width="46%"> 
            <% String segundo_nombre = (String)request.getAttribute("segundo_nombre"); %>  
                    <html:text property="segundo_nombre" size="30" styleClass="form" value="<%=segundo_nombre%>"/></td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Primer Apellido</strong> (*)&nbsp;&nbsp; 
            </td>
            <td width="46%"> 
            <% String primerApellido = (String)request.getAttribute("primerApellido"); %>  
                    <html:text property="primerApellido" size="15" styleClass="form" value="<%=primerApellido%>"/> &nbsp; 
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Segundo Apellido</strong> 
            </td>
            <td width="46%">
            <% String segundoApellido = (String)request.getAttribute("segundoApellido"); %>  
                    <html:text property="segundoApellido" size="15" styleClass="form" value="<%=segundoApellido%>"/> &nbsp;&nbsp; 
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Fecha Nacimiento</strong> (dd/mm/aaaa)&nbsp;&nbsp;
            </td>
            <td width="46%">
              <P>
                <%  String day = (String)request.getAttribute("day"); %>
                <html:select property="dia" styleClass="form" value="<%=day%>">
                  <html:option value="dia">D&iacute;a</html:option>
                  <% 
        for(int i = 1; i<=31;i++)
        {
          String dia = i+"";
          if(i<10) dia = "0"+i;
%>
                  <html:option value="<%=dia%>">
                    <%= dia%>
                  </html:option>
                  <%          
        }                  
%>
                </html:select>
                <FONT color="#000000">/</FONT> 
                <%  String month = (String)request.getAttribute("month"); %>
                <html:select property="mes" styleClass="form" value="<%=month%>">
                  <html:option value="mes">Mes</html:option>
                  <% 
        for(int i = 1; i<=12;i++)
        {
          String mes = i+"";
          if(i<10) mes = "0"+i;
%>
                  <html:option value="<%=mes%>">
                    <%= mes%>
                  </html:option>
                  <%          
        }                  
%>
                </html:select>
                <FONT color="#000000">/ </FONT>
                <%  String year = (String)request.getAttribute("year"); %>
                <html:select property="ano" styleClass="form" value="<%=year%>">
                  <html:option value="ano">A&ntilde;o</html:option>
                  <% 
        for(int i = 1900; i<=2030;i++)
        {
          String ano = i+"";
%>
                  <html:option value="<%=ano%>">
                    <%= ano%>
                  </html:option>
                  <%          
        }                  
%>
                </html:select>
              </P>
              <P align="center">
                <input type="hidden" name="fecha"/>
              </P> 
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Sexo</strong>
            </td>
            <td width="46%"> 
            <% String sexo = (String)request.getAttribute("sexo"); %>
                  <html:select property="sexo"  styleClass="form"  value="<%=sexo%>">
                    <html:option value="M">Masculino</html:option>
                    <html:option value="F">Femenino</html:option>
                  </html:select>
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Tel�fono</strong>
            </td>
            <td width="46%"> 
            <% String telefono = (String)request.getAttribute("telefono"); %>  
                    <html:text property="telefono" size="15" styleClass="form" value="<%=telefono%>"/></td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td colspan="3" class="celdatabla">
              <DIV align="left">
                <P>
                  <strong>Direcci&oacute;n Encasillada</strong> 
                </P>
                </DIV>
            </td>
           </tr>
           <tr>
             <td width="28%">&nbsp;</td>
             <td colspan="3" class="celdatabla">
               <table cellspacing="3" align="left"  cellpadding="2" border="1" width="48%">
                 <tr>
                   <td colspan="4">
                     <DIV align="center">
                       <STRONG class="celdatabla">Datos de la via</STRONG> 
                     </DIV>
                   </td>
                   <td colspan="3">
                     <DIV align="center">
                       <STRONG class="celdatabla">Datos del cruce</STRONG>
                     </DIV>
                   </td>
                   <td colspan="3">
                     <DIV align="center">
                       <STRONG class="celdatabla">Datos adicionales</STRONG>
                     </DIV>
                   </td>
                 </tr>
                 <tr>
                   <td>
                     <DIV align="center">Tipo</DIV>
                   </td>
                   <td>
                     <DIV align="center">Or.</DIV>
                   </td>
                   <td>
                     <DIV align="center">Nro.</DIV>
                   </td>
                   <td>
                     <DIV align="center">Apn.</DIV>
                   </td>
                   <td>
                     <DIV align="center">Or.</DIV>
                   </td>
                   <td>
                     <DIV align="center">Nro.</DIV>
                   </td>
                   <td>
                     <DIV align="center">Apn.</DIV>
                   </td>
                   <td>
                     <DIV align="center">Placa</DIV>
                   </td>
                   <td>
                     <DIV align="center">Bloque</DIV>
                   </td>
                   <td>
                     <DIV align="center">Interior</DIV>
                   </td>

                 </tr>
                 <tr>
                   <td>
                    <% String tipo = (String)request.getAttribute("tipo"); 
                       if((Object)tipo == null) 
                       tipo = request.getParameter("viaTipo");
                       if((Object)tipo == null) tipo = "";
                    %>  
                     <select size="1" name="viaTipo" onchange="agregar(this,'tipo')"  onmouseover="this.T_WIDTH=180;this.T_TITLE='Tipo de via';return escape('Corresponde al tipo de via.')" class="form">
                     <% if((Object)tipo != null){
                            if(tipo.equals("0")){%>
                             <option value="0" selected="selected"></option>
                          <%}else{%>
                             <option value="0"></option>
                          <%}%>
                          <% if(tipo.equals("CR")){%>
                             <option value="CR" selected="selected">Carrera</option>
                          <%}else{%>
                             <option value="CR">Carrera</option>
                          <%}%>
                          <% if(tipo.equals("CL")){%>
                             <option value="CL" selected="selected">Calle</option>
                          <%}else{%>
                             <option value="CL">Calle</option>
                           <%}%>
                          <% if(tipo.equals("CQ")){%>  
                             <option value="CQ" selected="selected">Circular</option>
                          <%}else{%>
                             <option value="CQ">Circular</option>
                           <%}%>
                          <% if(tipo.equals("TR")){%>
                             <option value="TR" selected="selected">Transversal</option>
                          <%}else{%>
                             <option value="TR" >Transversal</option>
                           <%}%>
                          <% if(tipo.equals("DG")){%>
                             <option value="DG" selected="selected">Diagonal</option>
                          <%}else{%>
                             <option value="DG">Diagonal</option>
                           <%}%>
                          <% if(tipo.equals("AV")){%>
                             <option value="AV" selected="selected">Avenida</option>
                          <%}else{%>
                             <option value="AV">Avenida</option>
                          <%}
                          }else{%>
                            <option value="0"></option>
                            <option value="CR">Carrera</option>
                            <option value="CL">Calle</option>
                            <option value="CQ">Circular</option>
                            <option value="TR" >Transversal</option>
                            <option value="DG">Diagonal</option>
                            <option value="AV">Avenida</option>
                          <%}%>
                     </select>
                   </td>
                   <td>
                   <% String vOr = (String)request.getAttribute("vOr"); 
                      if((Object)vOr == null) vOr = request.getParameter("viaOrientacion");
                      if((Object)vOr == null) vOr = "";
                   %>  
                     <select size="1" class="form" onchange="agregar(this,'vOr')" name="viaOrientacion" onmouseover="this.T_WIDTH=180;this.T_TITLE='Orientacion de la via';return escape('Corresponde a la orientacion de la via.')">
                     <% if((Object)vOr != null){
                            if(vOr.equals("0")){%>
                       <option value="0" selected="selected"></option>
                    <%}else{%>
                       <option value="0"></option>
                    <%}%>
                    <% if(vOr.equals("E")){%>
                       <option value="E" selected="selected">Este</option>
                    <%}else{%>
                       <option value="E">Este</option>
                    <%}%>
                    <% if(vOr.equals("E")){%>
                       <option value="S" selected="selected">Sur</option>
                    <%}else{%>
                       <option value="S">Sur</option>
                     <%}
                    }else{%>  
                       <option value="0"></option>
                       <option value="E">Este</option>
                       <option value="S">Sur</option>
                    <%}%>
                     </select>
                   </td>
                   <td>
                   <% String vNro = (String)request.getAttribute("vNro"); 
                      if((Object)vNro == null) vNro = request.getParameter("vNro");
                      if((Object)vNro == null) vNro = "";
                   %>  
                     <input type="text" value="<%=vNro%>" onchange="agregar(this,'vNro')" name="vNro" class="form" maxlength="3" size="3" onmouseover="this.T_WIDTH=180;this.T_TITLE='Numero de la via';return escape('Corresponde al numero de la via.')"/>
                   </td>       
                   <td>
                   <% String vAp = (String)request.getAttribute("vAp"); 
                      if((Object)vAp == null) vAp = request.getParameter("viaApendice");
                      if((Object)vAp == null) vAp = "";
                   %>  
                     <input type="text" value="<%=vAp%>" class="form" size="2" maxlength="2"  name="viaApendice" onchange="agregar(this,'vApn')" onmouseover="this.T_WIDTH=180;this.T_TITLE='Apendice de la via';return escape('Corresponde al apendice; ejemplo: A, AA, B, BB etc.')"/>
                   </td>
                   <td>
                     <DIV align="center">
                     <% String cOr = (String)request.getAttribute("cOr"); 
                        if((Object) cOr == null) cOr = request.getParameter("cruceOrientacion");
                        if((Object) cOr == null) cOr = "";
                     %>  
                       <select size="1" class="form" name="cruceOrientacion" onchange="agregar(this,'cOr')" onmouseover="this.T_WIDTH=180;this.T_TITLE='Orientacion del cruce';return escape('Corresponde a la orientacion del cruce.')">
                         <% if((Object)cOr != null){
                            if(cOr.equals("0")){%>
                       <option value="0" selected="selected"></option>
                    <%}else{%>
                       <option value="0"></option>
                    <%}%>
                    <% if(cOr.equals("E")){%>
                       <option value="E" selected="selected">Este</option>
                    <%}else{%>
                       <option value="E">Este</option>
                    <%}%>
                    <% if(cOr.equals("S")){%>
                       <option value="S" selected="selected">Sur</option>
                    <%}else{%>
                       <option value="S">Sur</option>
                     <%}
                    }else{%>  
                       <option value="0"></option>
                       <option value="E">Este</option>
                       <option value="S">Sur</option>
                    <%}%>
                       </select>
                     </DIV>
                   </td>
                   <td>
                     <DIV align="center">
                      <% String cNro = (String)request.getAttribute("cNro"); 
                      if((Object)cNro == null) cNro = request.getParameter("cruceNumero");
                      if((Object)cNro == null) cNro = "";
                      %>  
                       <input type="text" value="<%=cNro%>" class="form" size="3" maxlength="3" name="cruceNumero" onchange="agregar(this,'cNro')" onmouseover="this.T_WIDTH=180;this.T_TITLE='Numero del cruce';return escape('Primer numero de la placa de la puerta.')"/>
                     </DIV>
                   </td>
                   <td>
                     <DIV align="center">
                     <% String cAp = (String)request.getAttribute("cAp"); 
                      if((Object)cAp == null) cAp = request.getParameter("cruceApendice");
                      if((Object)cAp == null) cAp = "";
                    %>  
                       <input type="text" value="<%=cAp%>" class="form" maxlength="2" size="2" name="cruceApendice" onchange="agregar(this,'cApn')" onmouseover="this.T_WIDTH=180;this.T_TITLE='Apendice del cruce';return escape('Corresponde al apendice; ejemplo: A, AA, B, BB etc.')"/>
                     </DIV>
                   </td>
                   <td>
                     <DIV align="center">
                    <% String placa = (String)request.getAttribute("placa"); 
                      if((Object)placa == null) placa = request.getParameter("placa");
                      if((Object)placa == null) placa = "";
                    %>  
                       <input type="text" value="<%=placa%>" size="3" maxlength="3" name="placa" onchange="agregar(this,'placa')" class="form" onmouseover="this.T_WIDTH=180;this.T_TITLE='Placa';return escape('Es el segundo numero de la puerta y que corresponde a la distancia que existe entre la esquina y la propiedad.')"/>
                     </DIV>
                   </td>
                   <td>
                     <DIV align="center">
                    <% String bloque = (String)request.getAttribute("bloque"); 
                      if((Object)bloque == null) bloque = request.getParameter("bloque");
                      if((Object)bloque == null) bloque = "";
                    %>
                       <input type="text" value="<%=bloque%>" class="form" maxlength="2" name="bloque" onchange="agregar(this,'bloque')" size="2" onmouseover="this.T_WIDTH=180;this.T_TITLE='Bloque';return escape('Aplica para edificios o unidades residenciales.')"/>
                     </DIV>
                   </td>
                   <td>
                     <DIV align="center">
                     <% String interior = (String)request.getAttribute("interior"); 
                      if((Object)interior == null) interior = request.getParameter("interior");
                      if((Object)interior == null) interior = "";
                     %>
                       <input type="text" value="<%=interior%>" class="form" size="5" name="interior" onchange="agregar(this,'interior')" maxlength="5" onmouseover="this.T_WIDTH=180;this.T_TITLE='Interior';return escape('El numero de apartamento, si es el caso.')"/>
                     </DIV>
                   </td>

                 </tr>
                 <tr>
                    <td colspan="10">
                      <DIV align="center">
                        <STRONG>Direccion Generada
                        </STRONG>
                      </DIV>
                    </td>
                 </tr>
                 <tr>
                    <td colspan="10">
                      <% String dirEncasillada = (String)request.getAttribute("dirEncasillada"); 
                         if((Object) dirEncasillada == null) dirEncasillada = request.getParameter("dirEncasillada");
                         if((Object) dirEncasillada == null) dirEncasillada = "";
                      %>  
                      <DIV align="center"><html:text property="dirEncasillada" size="40" value="<%=dirEncasillada%>" styleClass="form" readonly="true"/>
                          <input type="button" value="Limpiar" onclick="LimpiarEnc()"/>
                      </DIV>
                    </td>
                 </tr>
               </table>
             </td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Direcci&oacute;n Descriptiva</strong>
            </td>
            <td width="46%"> 
            <% String dirDescriptiva = (String)request.getAttribute("dirDescriptiva"); %>  
                    <html:text property="dirDescriptiva" size="40" styleClass="form" value="<%=dirDescriptiva%>"/>
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Barrio/Vereda</strong>
            </td>
            <td width="46%"> 
            <% String barrio = (String)request.getAttribute("barrio"); %>  
                    <html:select property="codeBarrio" styleClass="form" value="<%=barrio%>" onchange="buscarBarrios('barrio')">
                        <html:option value="">Seleccione un barrio</html:option>
                        <logic:present name="barrios">
                          <html:options name="barrios" labelName="code" labelProperty="descVflex" property="code" collection="barrios" />
                        </logic:present>
                    </html:select>
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Comuna/Corregimiento</strong>
            <input type="hidden" name="opcion" value=""/>
            </td>
            <td width="46%"> 
            <% 
                 String comuna = (String)request.getAttribute("comuna"); 
            %>
                <html:select property="vflComuna" styleClass="form" value="<%=comuna%>">
                    <html:option value="">Seleccione una comuna</html:option>
                    <html:options name="comunas" labelName="code" labelProperty="descVflex" property="code" collection="comunas" />
                </html:select>
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Zona</strong>
            </td>
            <td width="46%"> 
            <% String zona = (String)request.getAttribute("zona"); %>  
                    <html:select property="codeZona" styleClass="form" value="<%=zona%>">
                        <html:option value="">Seleccione una zona</html:option>
                        <html:options name="zonas" labelName="code" labelProperty="descVflex" property="code" collection="zonas" />
                    </html:select>
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
            <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Cobama</strong>
            </td>
            <td width="46%"> 
            <% String cobama = (String)request.getAttribute("cobama"); %>  
                    <html:text property="cobama" size="8" maxlength="7" styleClass="form" value="<%=cobama%>"/></td>
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>Etnia</strong>
            </td>
            <td width="46%"> 
            <% String etnia = (String)request.getAttribute("etnia"); %>
                    <html:select property="etnia" styleClass="form" value="<%=etnia%>">
                        <html:option value="O">Otra</html:option>
                        <html:option value="A">Afrocolombiano</html:option>
                        <html:option value="I">Indigena</html:option>
                    </html:select>
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
            <td width="28%">&nbsp;</td>
            <td width="23%" class="celdatabla"><strong>E-mail</strong>
            </td>
            <td width="46%"> 
            <% String mail = (String)request.getAttribute("mail"); %>
                    <html:text property="mail" size="20" styleClass="form" value="<%=mail%>" />
            </td>
            <td width="3%">&nbsp;</td>
           </tr>
           <tr>
           <tr>
            <td colspan="4">&nbsp;</td>
           </tr>
           <tr>
             <td  colspan="4">
               <DIV align="center">
                 <input type="button" value="Guardar" onClick="validar();"/>
               </DIV>
             </td>
           </tr>
           </table>
          </td>
        </tr>  
       </html:form>  
      </table>

<script language="javascript">
  var tipo = document.actualizarBeneficiario.viaTipo.value;
  var vNro = document.actualizarBeneficiario.vNro.value;
  var vOr = document.actualizarBeneficiario.viaOrientacion.value;
  var vApn = document.actualizarBeneficiario.viaApendice.value;
  var cOr = document.actualizarBeneficiario.cruceOrientacion.value;
  var cNro = document.actualizarBeneficiario.cruceNumero.value;
  var cApn = document.actualizarBeneficiario.cruceApendice.value;
  var placa = document.actualizarBeneficiario.placa.value;
  var interior = document.actualizarBeneficiario.interior.value;
  var bloque = document.actualizarBeneficiario.bloque.value;
</script>

<table  cellspacing="3" cellpadding="2" border="0" width="70%" align="center">
 
    <tr>
      <td align="center">
        <%
              java.util.Enumeration enumera = request.getParameterNames();
              java.util.HashMap params = new java.util.HashMap();
              while(enumera.hasMoreElements())
              {
                String key = enumera.nextElement().toString();
                String value = request.getParameter(key);
                params.put(key, value);
              }
       
              params.put("regresar", "1");
              pageContext.setAttribute("parametros", params);
         %>
          <html:link name="parametros" scope="page" page="/beneficiarios/Buscar.do">
            <img src="<%= request.getContextPath() + "/images/b_atras.gif" %>" width="24" height="15" border="0"/>
            <br/>
            <span class="celdaayd">Atras</span>
          </html:link>
      </td>
    </tr>
</table>
<% session.removeAttribute("beneficiarios"); %>
</body>
</html>